<?php
Class Model extends CI_Model
{
	function get_data($table, $fields)
	{
		$this->db->select('*');
		$this->db->from($table);

		$query = $this->db->get();

		if($query -> num_rows() > 0) {
			return $query->result();
		} else {
			return array();
		}
	}
	
	function get_data_by_id($table, $where){
		$this->db->select('*');
		$this->db->from($table);
		$this->db->where($where);
		
		$query = $this->db->get();
		return $query->row();
	}
	
	function insert($table, $value){
		$tambah = $this->db->insert($table, $value);
		return $tambah;
	}
}
?>